package com.cross.core;

/**
 * 数据的列,如在excel中为一列
 * 
 * @date 2009-2-4
 * @author craziness_stone
 */
public final class Column implements Cloneable {

	// 列号
	private int number;
	// 列名
	private String title;
	// 数据类型
	private String type;
	//精度
	private int precision;
	//字符型长度是否可变 true可变,false固定长度
	private Boolean variable = Boolean.TRUE;

	/**
	 * 构造方法
	 * 
	 * 2009-5-11
	 * 
	 * @author craziness_stone
	 * @param number
	 * @param title
	 * @param type
	 */
	public Column(int number, String title, String type) {
		this.number = number;
		this.title = title;
		this.type = type;
	}
	
	/**
	 * 构造方法
	 * 
	 * 2009-5-11
	 * 
	 * @author craziness_stone
	 * @param number
	 * @param title
	 * @param type
	 */
	public Column(int number, String title, String type, int precision) {
		this.number = number;
		this.title = title;
		this.type = type;
		this.precision = precision;
	}
	/**
	 * 构造方法
	 * 
	 * 2009-5-11
	 * 
	 * @author craziness_stone
	 * @param number
	 * @param title
	 * @param type
	 */
	public Column(int number, String title, String type, int precision, boolean variable) {
		this.number = number;
		this.title = title;
		this.type = type;
		this.precision = precision;
		this.variable = Boolean.valueOf(variable);
	}

	/**
	 * 获得该列为第几列
	 * 
	 * 2009-2-4
	 * 
	 * @author craziness_stone
	 * @return
	 */
	public int getNumber() {
		return number;
	}

	/**
	 * 获得列的表头标题
	 * 
	 * 2009-2-4
	 * 
	 * @author craziness_stone
	 * @return
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * 获得列数据的类型
	 * 
	 * 2009-2-7
	 * 
	 * @author craziness_stone
	 * @return
	 */
	public String getType() {
		return type;
	}

	/**
	 * 复制一个列对象
	 * 
	 *
	 * 2009-5-11 
	 * @author craziness_stone
	 * @return
	 */
	public Column clone() {
		return new Column(number, title, type, precision, variable);
	}

	public int getPrecision() {
		return precision;
	}
	
	public Boolean isVariable() {
		return variable;
	}
}
